<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
         trimDirectiveWhitespaces="true"%>
<%@ page import="com.myfoon.action.backing.system.CountryBean, com.myfoon.model.entity.CountryName"%>
<%@ page import="javax.ejb.EJB"%>
<%@ page import="com.myfoon.model.cacheable.EventCache, 
                 com.myfoon.model.ejb.EventEJBLocal, 
                 com.myfoon.action.backing.system.EventBean,
                 com.myfoon.model.entity.result.EventOfFriend,
                 com.myfoon.helper.SessionHelper,
                 com.myfoon.model.entity.User"%>
<%@ page import="com.myfoon.model.cacheable.EventCache, 
                 com.myfoon.model.ejb.EventEJBLocal, 
                 com.myfoon.model.entity.result.EventOfFriend"%>
<%@ page import="java.util.List"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%        
    String start = request.getParameter("start");        
    Integer st = start == null ? 0 : Integer.parseInt(start);
    request.setAttribute("start", st);    
    
    String fu_tz = "0";       
    SessionHelper sessionHelper = new SessionHelper(request);
    Integer tzOffset = sessionHelper.getTimeZoneOffset();
    EventBean eventBean = new EventBean();
    User user = (User)session.getAttribute("user");
    List<EventOfFriend> eventsOfFriends = eventBean.getLastEvents(user, tzOffset, true, st, 15);
    request.setAttribute("user", user);
    request.setAttribute("eventsOfFriends", eventsOfFriends);
%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" media="screen" type="text/css" href="/css/cb/colorbox.css"/>
    <link rel="stylesheet" media="screen" type="text/css" href="/css/cb/cb.css"/>
    <!--[if IE]>
        <link rel="stylesheet" media="screen" type="text/css" href="/css/cb/cb-ie.css"/>        
    <![endif]-->
    
    <link rel="stylesheet" type="text/css" href="/css/global.css"/>    
    <link rel="stylesheet" type="text/css" href="/css/home.css"/>      
    <title>Home</title>
  </head>
  <body>
    <script type="text/javascript" src="/js/jquery.min.js"></script>    
    <script type="text/javascript" src="/js/jquery.scrollable.js"></script>    
    <script type="text/javascript" src="/js/jquery.timers.js"></script>    
    <script type="text/javascript" src="/js/curve.js"></script>
    <script type="text/javascript" src="/js/cb/jquery.colorbox.min.js"></script>
    <script type="text/javascript" src="/js/json2.js"></script>
    <script type="text/javascript" src="/js/home3.js"></script>
    <script type="text/javascript">           
      $(function() {                        
          $('.toolbox').cornerz({radius: 4, background: "white"})          
          $('#side').cornerz({radius: 6, background: "white"})                              
          $('.searchbox').cornerz({radius: 4, background: "white", corners: "bl br"})
          $('.r2side').cornerz({radius: 4, background: "white"})          
          $('td.photo').cornerz({radius: 4, background: "white"})          
        })      
    </script>  
    <div id="content">
      <div id="top">
        <div id="top_menu">
          <span>
            <a href="/home.jsp">Home</a>
          </span>
           
          <span class="separator">|</span>
           
          <span>
            <a href="/profile.jsp">Profile</a>
          </span>
           
          <span class="separator">|</span>
           
          <span>
            <a href="/friends.jsp">Friends</a>
          </span>
           
          <span class="separator">|</span>
           
          <span>
            <a href="/friends.jsp">My Wiki</a>
          </span>
           
          <span class="separator">|</span>
           
          <span>
            <a href="/communities.jsp" class="menulink">My Communities</a>
          </span>
        </div>
         
        <div class="top_menu_right">                
          <select class="mf_input mf_lang">            
            <option value="1">English</option>
          </select>
        </div>
         
        <div class="top_menu_right">
          <span>
            <a href="/settings.jsp">Settings</a>
          </span>
           
          <span class="separator">|</span>
           
          <span>
            <a href="/help.jsp">Help</a>
          </span>
           
          <span class="separator">|</span>
           
          <span>
            <a href="/logout.jsp">Logout</a>
          </span>
        </div>
      </div>
       
      <div id="main">
        <div id="side">
          <div id="p_img">
            <img src="/images/onur.jpg" width="120" border="0"/>
          </div>
           
          <div class="menubox">
            <ul>
              <li>
                <%= user.getUserPi().getFullname() %>
              </li>
            </ul>
          </div>
           
          <div class="toolbox2">
            <ul>
              <li>All</li>
              <li>Follow List</li>
              <li>Favorites</li>
              <li>Where friends are</li>
              <li>Only Photos</li>
              <li>Only Videos</li>
            </ul>
          </div>
           
          <div class="menubox">
            <h4>Applications</h4>            
            <ul>
              <li>
                <img src="/images/gift.gif"
                     height="16" width="15" border="0"
                     style="vertical-align:middle;"></img>
                <a href="abc">Gifts</a>
              </li>
              <li>
                <img src="/images/speed_date.gif"
                     height="16" width="16" border="0"
                     style="vertical-align:middle;"></img>
                <a href="abc">Speed Date</a>
              </li>
              <li>
                <img src="/images/anket.gif"
                     height="16" width="16" border="0"
                     style="vertical-align:middle;"></img>
                <a href="abc">Se&ccedil;im Anketi</a>
              </li>
            </ul>
          </div>
        </div>
                 
        <div id="right">
          <div id="r1">
            <div id="messagebox" class="rd">
              <h3 id="mbox_header">Share with contacts</h3>          
              <div id="mbox_content">
              <form id="event_form" action="/pub/Submit" method="POST">
                <table cellpadding="0" cellspacing="0" border="0" summary=""
                       width="100%" style="width: 100%; margin: 0; padding: 0">
                  <tr>
                    <td colspan="2">
                      <select id="date_select" name="ds" class="mf_input">
                        <option value="0">2 Days ago</option>
                        <option value="1">Yesterday</option>
                        <option value="2">Today</option>
                        <option value="3" selected="selected">Now</option>
                        <option value="4">Tomorrow</option>
                        <option value="5">2 Days later</option>
                        <option value="6">Select any date</option>
                      </select>
                      <span id="date_part" style="display: none;">
                        <a href="javascript: void(0);" onclick="alert(1);"
                           style="margin: 0; padding: 0;">
                           
                          <img src="images/calendar.png" height="16" width="16"
                               border="0" style="vertical-align:middle;"></img>
                           </a>
                        <select id="date_month" name="dm" class="mf_input">
                          <option value="1" selected="selected">
                            <fmt:message key="global.month.1"/>
                          </option>
                          <c:forEach begin="2" end="12" var="month">
                            <option value="${month}">
                              <fmt:message key="global.month.${month}"/>
                            </option>
                          </c:forEach>
                        </select>
                        <select id="date_day" name="dd" class="mf_input">
                          <option value="1" selected="selected">1</option>
                          <c:forEach begin="2" end="31" var="day">
                            <option value="${day}">
                              ${day}
                            </option>
                          </c:forEach>
                        </select>
                      </span>
                      <span id="time_part" style="display: none;">
                        <span id="date_at" class="event_time event_at">at</span>
                        <select id="time_hour" class="mf_input" name="th">
                          <c:forEach begin="0" end="23" var="hour">
                            <option value="${hour}">
                              <c:if test="${hour < 10}">0</c:if>
                              ${hour}
                            </option>
                          </c:forEach>
                        </select>
                        <span class="event_at">:</span>
                        <select id="time_minute" class="mf_input" name="tm">
                          <option value="0">00</option>
                          <option value="1">15</option>
                          <option value="2">30</option>
                          <option value="3">45</option>
                        </select>
                      </span>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="2">
                      <textarea cols="" rows="2" name="m" id="message_box"
                                class="mf_input mf_wideinput mf_messagebox"></textarea>
                    </td>
                  </tr>
                  <tr>
                    <td align="left">
                      <a id="app1" class="applink first" href="javascript: void(0);"
                         style="background-image: url('/images/photo-icon.png'); background-position: left; background-repeat: no-repeat;">Image</a>
                      <a id="app2" class="applink" href="/test/MapsTest.html"
                         style="background-image: url('/images/map-icon.png'); background-position: left; background-repeat: no-repeat;">Geolocation</a>
                      <a id="app3" class="applink" href="javascript: void(0);"
                         style="background-image: url('/images/video-icon.png'); background-position: left; background-repeat: no-repeat;">Video</a>                      
                      <a id="app4" class="applink" href="javascript: void(0);"
                         style="background-image: url('/images/people.png'); background-position: left; background-repeat: no-repeat;">People</a>                      
                    </td>
                    <td align="right">
                      <button id="submit_button" name="submit_button">Post</button>
                    </td>
                  </tr>
                </table>
              </form>
              </div>              
              <div id="attach_content" style="display: none;">                    
              </div>              
              <div id="attachments">                                             
                <ul id="attachedList">
                </ul>                    
              </div>                            
            </div>
            <div id="recentpostsbox" class="rd">
              <div>
                <h3>Recent shares</h3>
              </div>
               
              <div>
                <c:url var="nextUrl" value="/home.jsp#">
                  <c:param name="start" value="${start + 15}"/>
                </c:url>
                 
                <c:url var="prevUrl" value="/home.jsp#">
                  <c:param name="start"
                           value="${ ((start - 15) < 0 ? 0 : start - 15 ) }"/>
                </c:url>
                 
                <a href="${prevUrl}" id="prevE" class="profile_link"><c:out value="Previous"/></a>
                 
                <a href="${nextUrl}" id="nextE" class="profile_link"><c:out value="Next"/></a>
              </div>
               
              <div id="recentposts">
                <table width="100%" cellpadding="5" cellspacing="0" border="0"
                       class="rp">
                  <c:forEach var="evf" items="${eventsOfFriends}">
                    <tr>
                      <td width="60px" class="photo">
                        <img src="${evf.ownerPhotoSmall}" width="50"/>
                      </td>
                      <td>
                        <span class="event_info">
                          <c:if test="${user.id == evf.ownerId }">
                            <c:out value="${evf.ownerFullname}"></c:out>
                          </c:if>                          
                          <c:if test="${user.id != evf.ownerId }">
                            <c:url var="url" value="/profile.jsp">
                                <c:param name="id" value="${evf.ownerId}"/>
                            </c:url>                        
                            <a href="${url}" class="profile_link">
                            <c:out value="${evf.ownerFullname}"/>
                            </a>                        
                          </c:if>
                          <span class="event_time">
                            <fmt:formatDate type="time" timeStyle="short"
                                            value="${evf.date}"/>
                          </span>
                        </span>
                        <div class="event_message">
                          <span>
                            <c:out value="${evf.message}"/>
                          </span>
                        </div>
                        <c:if test="${evf.photoCount > 0}">
                            <div style="margin-top: 10px;">
                                <a id="app1" class="applink first" href="javascript: void(0);"
                                style="background-image: url(/images/photo-icon.png); background-position: left; background-repeat: no-repeat;">
                                    <c:out value="${evf.photoCount} Images"/>
                                </a>
                            </div>
                        </c:if>               
                      </td>
                    </tr>
                  </c:forEach>
                </table>
              </div>
            </div>
          </div>
           
          <div id="r2">
            <div class="searchbox">
              <input type="text" class="mf_input mf_search"/>
              <a class="search_button" href="javascript: void(0);" onclick="alert('search');"></a>     
              <div style="clear: both;"></div>
            </div>
             
            <div class="r2side">
              <h4>Upcoming Events</h4>
            </div>
             
            <div class="r2side">
              <h4>Advertisement</h4>
               
              <div class="r2sidebox_first">
                <p>
                  <a href="http://www.Eshopping-Europe.info" class="title">85%
                                                                           Off
                                                                           Luxury
                                                                           handbags</a>
                </p>
                 
                <span class="content">Top-quality Fashion brand Bags Native
                                      Warrantor for 100% shipping</span>
                 
                <p>
                  <a target="_blank" href="http://www.Eshopping-Europe.info">www.Eshopping-Europe.info</a>
                </p>
              </div>
               
              <div class="r2sidebox">
                <p>
                  <a href="http://www.kaanair.com" class="title">Agusta
                                                                 Helicopters
                                                                 Turkey</a>
                </p>
                 
                <span class="content">Kaan Air the exclusive distributor of
                                      AgustaWestland</span>
                 
                <a target="_blank" href="http://www.kaanair.com">www.kaanair.com</a>
              </div>
               
              <div class="r2sidebox">
                <p>
                  <a href="http://www.GittiGidiyor.com/Sifir_Risk"
                     class="title">Shoe stores?</a>
                </p>
                 
                <span class="content">Aradığınız Herşey Burada! Sıfır Risk
                                      Sistemi ile G&uuml;venle Alın</span>
                 
                <a target="_blank"
                   href="http://www.GittiGidiyor.com/Sifir_Risk">www.GittiGidiyor.com/Sifir_Risk</a>
              </div>
            </div>
          </div>
        </div>
      </div>
       
      <div id="bottom">
        <div class="bottom2">
          <ul class="about">
            <li class="first">
              <fmt:message key="global.myfoon"/>
            </li>
            <li>
              <a href="/advertise"><fmt:message key="global.advertise"/></a>
            </li>
            <li>
              <a href="/advertise">Developers</a>
            </li>
            <li>
              <a href="/advertise">Careers</a>
            </li>
            <li>
              <a href="/advertise">Privacy Policy</a>
            </li>
            <li>
              <a href="/advertise">Terms of Service</a>
            </li>
            <li>
              <a href="/advertise">Send Feedback</a>
            </li>
            <li>
              <a href="/advertise"><fmt:message key="global.help"/></a>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <iframe id="uploadFrameID" name="uploadFrame" height="0" width="0" 
                frameborder="0" scrolling="yes"></iframe>                
  </body>
</html>